<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta
      name="viewport"
      content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"
    />
    <link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
    <link rel="stylesheet" href="/umi.css" />
    <script>
      window.routerBase = "/";
    </script>
    <script>
      //! umi version: 3.3.7
    </script>
    <title>如何工作的？</title>
  </head>
  <body>
    <div id="root"><div class="__dumi-default-layout" data-route="/guide/how-it-works" data-show-sidemenu="true" data-show-slugs="true" data-site-mode="true" data-gapless="false"><div class="__dumi-default-navbar" data-mode="site"><button class="__dumi-default-navbar-toggle"></button><a class="__dumi-default-navbar-logo" style="background-image:url(&#x27;./images/homebrew-256x256.png&#x27;)" href="/">Homebrew</a><nav><div class="__dumi-default-search"><input type="search" class="__dumi-default-search-input" value=""/><ul></ul></div><span><a aria-current="page" class="active" href="/guide">指南</a></span><span><a target="_blank" rel="noopener noreferrer" href="https://github.com/ineo6/homebrew-install">GitHub<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="__dumi-default-external-link-icon"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></span></nav></div><div class="__dumi-default-menu" data-mode="site"><div class="__dumi-default-menu-inner"><div class="__dumi-default-menu-header"><a class="__dumi-default-menu-logo" style="background-image:url(&#x27;./images/homebrew-256x256.png&#x27;)" href="/"></a><h1>Homebrew</h1><p></p></div><div class="__dumi-default-menu-mobile-area"><ul class="__dumi-default-menu-nav-list"><li><a aria-current="page" class="active" href="/guide">指南</a></li><li><a target="_blank" rel="noopener noreferrer" href="https://github.com/ineo6/homebrew-install">GitHub<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="__dumi-default-external-link-icon"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li></ul></div><ul class="__dumi-default-menu-list"><li><a target="_blank" rel="noopener noreferrer">介 绍</a><ul><li><a href="/guide"><span>介 绍</span></a></li><li><a aria-current="page" class="active" href="/guide/how-it-works"><span>如何工作的？</span></a></li><li><a href="/guide/start"><span>快速开始</span></a></li></ul></li><li><a href="/guide/m1">M1芯片 </a></li><li><a href="/guide/faq">FAQ</a></li></ul></div></div><ul role="slug-list" class="__dumi-default-layout-toc"><li title="访问脚本" data-depth="2"><a href="/guide/how-it-works#访问脚本"><span>访问脚本</span></a></li><li title="安装加速" data-depth="2"><a href="/guide/how-it-works#安装加速"><span>安装加速</span></a></li></ul><div class="__dumi-default-layout-content"><div class="markdown"><h1 id="如何工作的？"><a aria-hidden="true" tabindex="-1" href="/guide/how-it-works#如何工作的？"><span class="icon,icon-link"></span></a>如何工作的？</h1><h2 id="访问脚本"><a aria-hidden="true" tabindex="-1" href="/guide/how-it-works#访问脚本"><span class="icon,icon-link"></span></a>访问脚本</h2><p><code>raw.githubusercontent.com</code>地址不稳定，导致无法访问官方安装脚本<code>install.sh</code>。</p><div class="__dumi-default-code-block"><pre class="prism-code language-shell"><button class="__dumi-default-icon __dumi-default-code-block-copy-btn" data-status="ready"></button><div class="token-line"><span class="token plain">curl: </span><span class="token punctuation">(</span><span class="token number">7</span><span class="token punctuation">)</span><span class="token plain"> Failed to connect to raw.githubusercontent.com port </span><span class="token number">443</span><span class="token plain">: Operation timed out</span></div><div class="token-line"><span class="token plain"></span></div></pre></div><p>解决方案就是托管到<code>jsdelivr</code>，通过<code>CDN</code>加速访问。</p><blockquote><p>另外也可以采用写入<code>hosts</code>的方式，可以一定程度解决<code>GitHub</code>资源无法访问的问题。</p><p>设置方案请阅读 <a target="_blank" rel="noopener noreferrer" href="https://mp.weixin.qq.com/s/gFNP2Pk81vg7nE1XsDingg">GitHub访问加速指南<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="__dumi-default-external-link-icon"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></p></blockquote><h2 id="安装加速"><a aria-hidden="true" tabindex="-1" href="/guide/how-it-works#安装加速"><span class="icon,icon-link"></span></a>安装加速</h2><p>修改脚本内容，把<code>brew</code>、<code>homebrew-core</code>到仓库地址为 <a target="_blank" rel="noopener noreferrer" href="http://mirrors.ustc.edu.cn/help/brew.git.html">中科大镜像<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="__dumi-default-external-link-icon"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> 提供的地址。</p><p>例如：</p><div class="__dumi-default-code-block"><pre class="prism-code language-shell"><button class="__dumi-default-icon __dumi-default-code-block-copy-btn" data-status="ready"></button><div class="token-line"><span class="token plain">  </span><span class="token assign-left variable">STAT</span><span class="token operator">=</span><span class="token string">&quot;stat --printf&quot;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">  </span><span class="token assign-left variable">CHOWN</span><span class="token operator">=</span><span class="token string">&quot;/bin/chown&quot;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">  </span><span class="token assign-left variable">CHGRP</span><span class="token operator">=</span><span class="token string">&quot;/bin/chgrp&quot;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">  </span><span class="token assign-left variable">GROUP</span><span class="token operator">=</span><span class="token string">&quot;</span><span class="token string variable">$(</span><span class="token string variable function">id</span><span class="token string variable"> -gn</span><span class="token string variable">)</span><span class="token string">&quot;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">  </span><span class="token assign-left variable">TOUCH</span><span class="token operator">=</span><span class="token string">&quot;/bin/touch&quot;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain"></span><span class="token keyword">fi</span><span class="token plain"></span></div><div class="token-line"><span class="token plain"></span><span class="token comment"># 这里替换了BREW_REPO</span><span class="token plain"></span></div><div class="token-line"><span class="token plain"></span><span class="token assign-left variable">BREW_REPO</span><span class="token operator">=</span><span class="token string">&quot;https://mirrors.ustc.edu.cn/brew.git&quot;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain"></span></div></pre></div></div><div class="__dumi-default-layout-footer-meta"><span data-updated-text="最后更新时间：">1970-1-1 8:00:00</span></div></div></div></div>
	<script>
  window.g_useSSR = true;
  window.g_initialProps = {};
	</script>

    <script src="/umi.js"></script>
  </body>
</html>
